package com.hue.springbootvalidation.domain;

import lombok.Data;
import lombok.ToString;

import javax.validation.Valid;
import javax.validation.constraints.Max;
import javax.validation.constraints.Min;
import javax.validation.constraints.NotBlank;

/**
 * @Author: yfq
 * @Date: 2022/8/4 16:09
 * @Description: 嵌套效验，在需要嵌套效验的字段上加@valid注解
 */
@Data
@ToString
public class Person {
    @NotBlank
    private String name;

    @Max(value = 100, message = "age最大为100")
    @Min(value = 0, message = "age最小为0")
    private Integer age;

    @Valid
    private Dog dog;
}
